<?php
namespace Home\Controller;
use Think\Controller;
class LoginController extends Controller {
    public function login(){
        $this->display();
    }
	public function loginreserve(){
		$this->display();
	}
    public function checklog(){
        $name = $_POST['username'];
     
        $password = md5($_POST['password']);
        $m = M("user");
        $msguser = $m->where("username = '$name'")->find();
       
        $msgtelephone = $m->where("telephone = '$name'")->find();
    
        if($msguser['password'] == $password || $msgtelephone['password'] == $password){
            session("username", $name);
            $this->success("登录成功", __APP__."/Home/Index/index");
        }else{
            $this->error("用户名或密码错误");
        }
    }
    public function loginout(){
        session('username', null);
        $this->success("注销成功");
    }
}